﻿using NUnit.Framework;

namespace RESTController.Lib
{
    [TestFixture]
    public class IntegerExtensionsTests
    {
        [Test]
        [TestCase(5, Result = 4, Description = "ToIndex should subtract 1 from positive numbers.")]
        [TestCase(1, Result = 0, Description = "ToIndex should subtract 1 from positive numbers")]
        [TestCase(null, Result = 0, Description = "Null values should return 0.")]
        [TestCase(0, Result = 0, Description = "0 should return 0.")]
        [TestCase(-2, Result = 0, Description = "Negative numbers should return 0.")]
        public int ToIndex_ReturnsExpectedResult(int? i)
        {            
            return i.ToIndex();
        }

        
    }
}
